<?php
error_reporting(0);
//-------------parser----------------------------------------------------
$args     	= ($_REQUEST["args"]!="")? $_REQUEST["args"]        : "";
$g_arrArgs	= explode("/",$args);

extract($g_arrArgs,EXTR_SKIP);
//--------------include framework_config file--------------------------------------------------------------
include ("library/config/fw_config.php");
ini_set('memory_limit','40M');
include ("check_validate.php");
if ( !isset($_SESSION["SOLVAY_MBA"]) )
{
	session_register("SOLVAY_MBA");
	$_SESSION["SOLVAY_MBA"] = "SOLVAY_MBA";
}
//-------------------------route controller----------------------------------------------------------------
$controller = ($_REQUEST["m"]!="")? ucfirst($_REQUEST["m"])		: ucfirst(DEFAULT_CONTROLLER);
$action     = ($_REQUEST["a"]!="")? strtolower($_REQUEST["a"])	: strtolower(DEFAULT_CONTROLLER_ACTION);

//register var modules, action and args
DRX::register("controller", strtolower($controller));
DRX::register("action", $action);
DRX::register("args", $args);

$smarty = DRX::load('smarty');


if(isset($page) && $page>0) DRX::register("page", $page);

//--------------include language file----------------------------------------------------------------------
//if ($current_lang != '') {
//	include_once (APPLICATION_DIR."/application/language/".$current_lang."/common.php");
//}

$ControllerName = $controller."Controller";
$ActionName 	= $action."Action";

if(file_exists("application/controller/".$ControllerName.".php")) 
{
	if (class_exists($ControllerName)) 
	{
        $objSmarty->assign("controller",strtolower($controller));
        $objSmarty->assign("action",strtolower($action));
        
		$objHandlerController = new $ControllerName();
		if(method_exists($objHandlerController,$ActionName)) 
		{
			$objHandlerController->$ActionName();
		}
		else 
		{
			die("Cannot find method <strong>".$ActionName."</strong> in ".$ControllerName." class to execute");
		}
	}
	else 
	{
		die("Cannot find className <strong>".$ControllerName."</strong> in ".$ControllerName.".php modules to execute");
	}
}
else 
{
	die("Cannot find controller modules $ControllerName to execute");
}
?>	